<!DOCTYPE html>
<html>
<head>
  <title>二维码管理</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
  <link href="/css/bootstrap-responsive.css" rel="stylesheet" media="screen">
  <link rel="stylesheet" type="text/css" href="/css/style.css">
  <script src="/lib/jq/jquery-2.1.1.min.js"></script>
  <script src="/lib/jq/bootstrap.min.js"></script>
  <script type="text/javascript" src="/js/bootstrap-paginator.min.js"></script>
  <script type="text/javascript" src="/js/jquery.qrcode.min.js"></script>
  <script type="text/javascript" src="/js/qrcodeM.js"></script>
  <script type="text/javascript">
$(function(){

//获得浏览器参数
$.extend({
getUrlVars: function(){
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
},
getUrlVar: function(name){
return $.getUrlVars()[name];
}
});

//封装浏览器参数
var composeUrlParams=function(){
var param='';
$.each($.getUrlVars(), function(i, item) {
if(item!='p'){
var val=$.getUrlVar(item);
if(val) param += "&" + item+"="+val;
}
});
return param;
}

//分页功能
var options = {
currentPage:<%- page.num %>,
totalPages:<%- page.pageCount %>,
numberOfPages:5,
pageUrl: function(type, page, current) {    //页面跳转
                    if(page!=<%- page.num %>){
                        return '/box_management/code?num='+ page+'&&sim=ok';
                    }

                }
}
$('#page1').bootstrapPaginator(options);
})
</script>
</head>
<body style="margin:15px;">
<div id="lert"></div>
<% if (success) { %>
<div class="alert alert-success">
    <h4><%= success %></h4>
</div>
<% } %>
<% if (error) { %>
<div class="alert alert-error">
    <h4><%= error %></h4>
</div>
<% } %>
    <tbody>
    <legend>Sim卡管理</legend>
      <div style="margin-bottom:15px;">
        <a href="/box_management/create_sim" style="text-decoration: none">
            <input type="button" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" value="新增"/>
        </a>
        <input type="button" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" name="checkAll" value="全选" onclick="changeAll()" />
        <input type="button" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" value="反选" onclick="fanxuan();change()"/>
        <input type="button" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" value="打印" onclick="Allprint()"/>
      </div>
      <table class="table table-bordered">
        <tr>
          <td class="td_sim" style="text-align: center;"> <b>SIM卡号</b>
          </td>
          <td class="operators" style="text-align: center;"><b>运营商</b>
          </td>
            <td class="charge" style="text-align: center;"><b>资费</b>
            </td>
          <td style="text-align: center;"><b>打印次数</b></td>
          <td class="operation" style="text-align: center;">
            <b>操作</b>
          </td>

        </tr>
        <% for(var i=0;i<datas.length;i++){ %>
          <%if(datas[i].box_id=="未绑定"){%>
          <tr>
              <td class="td_box_order" style="text-align: center;">
                  <%=datas[i].sim %>
              </td>
              <td class="operators" style="text-align: center;"><%=datas[i].operators%></td>
              <td style="text-align: center;"><%=datas[i].charge%></td>
              <td style="text-align: center;"><%=datas[i].state%></td>
              <td style="text-align: center" >
                  <button style="width:55px;height:30px;background-color:#ffffff;border:1px solid #ffffff;border-radius:3px;margin-right:5px;" disabled="disabled"></button>
                  <a href="/box_management/update_sim?sim=<%=datas[i].sim%>" style="text-decoration: none">
                      <input type="button" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;margin-right:5px;" value="编辑" name="<%=datas[i].sim%>"/>
                  </a>
                  <a href="/box_management/remo_sim?sim=<%=datas[i].sim%>" style="text-decoration: none" onclick="return confirm('确定删除该Sim卡?')">
                      <input type="button" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" value="删除"/>
                  </a>
              </td>
          </tr>
          <%}else{%>
        <tr>
          <td class="td_box_order" style="text-align: center;">
            <label class="checkbox inline">
              <input type="checkbox" name="son" value="<%=datas[i].box_id %>,<%=datas[i].sim %>"/><%=datas[i].sim %></label>
          </td>
          <td class="operators" style="text-align: center;"><%=datas[i].operators%></td>
          <td style="text-align: center;"><%=datas[i].charge%></td>
          <td style="text-align: center;"><%=datas[i].state%></td>
          <td style="text-align: center;" >
            <button style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;margin-right:5px;" class="operation_btn" id="<%=datas[i].box_id%>">预览</button>
            <!--<input style="margin-right:5px;" type="button" class="print" value="打印" onclick="state(this)" name="<%=datas[i].sim%>"/>-->
            <a href="/box_management/update_sim?sim=<%=datas[i].sim%>" style="text-decoration: none">
                <input type="button" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;margin-right:5px;" value="编辑" name="<%=datas[i].sim%>"/>
            </a>
            <a href="/box_management/remo_sim?sim=<%=datas[i].sim%>" style="text-decoration: none" onclick="return confirm('确定删除该Sim卡?')">
                <input type="button" style="width:55px;height:30px;background-color:#DBDBDB;border:1px solid #DBDBDB;border-radius:3px;" value="删除"/>
            </a>

          </td>
        </tr>
        <%}}%>
      </table>
    </tbody>
  <div class="span12">
<div id="page1" style="margin-bottom:0"></div>
</div>
  <!--startprint-->
  <div id='code' style="margin-left:35%;display:none"></div>
  <!--endprint-->
  <!--++++++++++-->
  <div id='Allcode' style="margin-left:10%;margin-bottom:10%;display:none"></div>
  <!--========-->
</body>

</html>